package com.slz3.business.module.wmsManagement.wmsTraysManage.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.functions.Add;
import com.slz3.business.frame.functions.Modify;
import com.slz3.business.frame.module.DomainEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Type;
import org.hibernate.validator.constraints.Length;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.sql.Types;
import java.time.LocalDate;
import java.util.UUID;

import static javax.persistence.EnumType.STRING;

@MappedSuperclass
@Data
@EqualsAndHashCode(callSuper = false)
public class WmsTraysManageEntity extends DomainEntity {

    /**
     * 仓库
     */
    @NotNull(message = "fkWmsHouseUuid 必须非空!", groups = {Add.class, Modify.class})
    private UUID fkWmsHouseUuid;

    /**
     * 库区
     */
    @NotNull(message = "fkWmsAreaUuid 必须非空!", groups = {Add.class, Modify.class})
    private UUID fkWmsAreaUuid;

    /**
     * 商品一级分类
     */
    @NotNull(message = "fkGooTypeLevel1Uuid 必须非空!", groups = {Add.class, Modify.class})
    private UUID fkGooTypeLevel1Uuid;

    /**
     * 商品二级分类
     */
    @NotNull(message = "fkGooTypeLevel2Uuid 必须非空!", groups = {Add.class, Modify.class})
    private UUID fkGooTypeLevel2Uuid;

    /**
     * 货位号
     */
    @NotNull(message = "serLocationNo 必须非空!", groups = {Add.class})
    private String serLocationNo;

    /**
     * 货位码数
     */
    @NotNull(message = "serLocationCodeNum 必须非空!", groups = {Add.class})
    @Type(type = "integer")
    private Integer serLocationCodeNum;

    /**
     * 审核状态
     */
    @Enumerated(STRING)
    @NotNull(message = "serAudit 必须非空!", groups = {Add.class})
    @Null(message = "serAudit 必须为空!", groups = {Modify.class})
    private AuditFlag serAudit;

    /**
     * 启用状态
     */
    @Enumerated(STRING)
    @NotNull(message = "serUsing 必须非空!", groups = {Add.class})
    @Null(message = "serUsing 必须为空!", groups = {Modify.class})
    private UsingFlag serUsing;

    /**
     * 标签
     */
    private String serLabels;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private LocalDate serInputGroupData;

}
